<div class="grid_12">
    <div class="box round first fullpage">
        <h2>Cập nhật tài khoản người dùng</h2>
        <div class="block ">
            <?=$this->form?>            
        </div>
    </div>
</div>
<script>
    $(function(){
       createEditor("article_content");
       
       //create thumb nail
       $("#user_image").change(function(e){
            // get image
            var thisObj = $(this);
            var url = URL.createObjectURL(e.target.files[0]);
            var img = new Image();
            
            var canvas = document.createElement("canvas");
            canvas.setAttribute("class","thumb");
            
            var ctx = canvas.getContext('2d');
            img.onload = function() {
                var h = 200, per = img.width/img.height;
                var w = h*per;
                canvas.height = h;
                canvas.width = w;
                $(".thumb").remove();
                thisObj.parent().append(canvas);
                ctx.drawImage(img, 0, 0,w ,h);    
            }
            img.src = url;   
       })
       
       $("#birthday").datepicker({
            dateFormat:"dd/mm/yy",
            changeMonth: true,
			changeYear: true,
            yearRange: "c-60:c+10"
       });
       // draw thumb
       <?php if(!empty($this->user_image)){?>
       $("#user_image").parent("dd")
                       .append("<img height='200' class='thumb' src='<?=$this->baseUrl("images/profile/$this->user_image")?>'/>");
       <?php }?>
    });
</script>